package at.ac.tuwien.mg.bean;

import java.util.Vector;

import javax.faces.bean.ManagedProperty;

import org.activiti.engine.ProcessEngine;
import org.activiti.engine.TaskService;

public class RankedOffers extends ManualOffers {

	private static final long serialVersionUID = 2228366482366663141L;
	private Offer toSelect;
	private TaskService ts;
	
	@ManagedProperty(value="#{activiti.processEngine}")
	private ProcessEngine engine;
	
	/*
	@ManagedProperty(value="#{user}")
	private User user;
	*/
	
	public RankedOffers() {
		//TODO: Martin - refactoring
		/*
		super();
		ts = engine.getTaskService();
		@SuppressWarnings("unchecked")
		Vector<Offer> offers = (Vector<Offer>) ts.getVariable(user.getLastProcInstanceId(), "offers");
		for(Offer o : offers) {
			System.out.println("Offer:" + o.getGood() + " " + o.getSupplier() + " " + o.getPrice());
		}
		setOffers(offers);
		*/
	}
	
	public Offer getToSelect() {
		return toSelect;
	}

	public void setToSelect(Offer toSelect) {
		this.toSelect = toSelect;
	}
	
	public String order() {
		/*
		ts.setVariable(user.getLastProcInstanceId(), "order", toSelect);
		*/
		return "inbox";
		
	}

	
}
